#include "gtray.h"

//#include <QApplication>
#include <QDebug>
#include <glib.h>
#include <libappindicator/app-indicator.h>
//#include <libappindicator/app-indicator.h>
static GMainLoop * mainloop = NULL;

void callback(){
    qDebug()<<"dasdssadasdasdasda";
}

int main(int argc, char *argv[])
{
//    QApplication a(argc, argv);
//    Gtray w;
//    w.show();

    gtk_init(&argc, &argv);


    GtkWidget *menu_item = gtk_menu_item_new_with_label("Test");
    GtkMenu *menu = GTK_MENU(gtk_menu_new());
    gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
    gtk_widget_show(menu_item);

    AppIndicator * ci = app_indicator_new("test-application",
                                          "evolution",
                                          APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
    app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE);
    app_indicator_set_menu(ci, menu);


    app_indicator_set_secondary_activate_target(ci,menu_item);
    g_signal_connect(menu_item,"activate",G_CALLBACK(callback),NULL);



//    g_signal_connect(ci,"scroll_event",G_CALLBACK(callback), NULL);
//    GtkStatusIcon *trayIcon = gtk_status_icon_new_from_icon_name("evolution");

    mainloop = g_main_loop_new(NULL, FALSE);
    g_main_loop_run(mainloop);

    g_object_unref(G_OBJECT(ci));
    g_object_unref(G_OBJECT(menu));
    g_object_unref(G_OBJECT(menu_item));
    return 0;
}


